package model;

import java.util.Date;

import javax.persistence.Embedded;
import javax.persistence.Id;

import com.google.appengine.api.blobstore.BlobKey;

public class EventInfo {

	@Id Long eid;
	String uid;
	String jid;
	int type;
	String name;
	String brief;
	Date deadline;	
	int limitCount;		
	double user_x;
	double user_y;
	String place;
	
	BlobKey photo;
	@Embedded EventStatus status;
	Date createTime;
	Date endTime;
	
	public EventInfo() {
		super();
	}

	public EventInfo(String uid, int type, String name, String brief,
			Date deadline, int limitCount, double x, double y, double user_x, double user_y, String place) 
	{
		super();
		this.uid = uid;
		this.type = type;
		this.name = name;
		this.brief = brief;				
		this.deadline = deadline;
		this.limitCount = limitCount;
		this.createTime = new Date();
		this.status = new EventStatus(x, y);
		this.user_x = user_x;
		this.user_y = user_y;
		this.place = place;
	}

	public Long getEid() {
		return eid;
	}

	public void setEid(Long eid) {
		this.eid = eid;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getBrief() {
		return brief;
	}

	public void setBrief(String brief) {
		this.brief = brief;
	}

	public Date getDeadline() {
		return deadline;
	}

	public void setDeadline(Date deadline) {
		this.deadline = deadline;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public int getLimitCount() {
		return limitCount;
	}

	public void setLimitCount(int limitCount) {
		this.limitCount = limitCount;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public EventStatus getStatus() {
		return status;
	}

	public void setStatus(EventStatus status) {
		this.status = status;
	}
	
	public BlobKey getPhoto() {
		return photo;
	}

	public void setPhoto(BlobKey photo) {
		this.photo = photo;
	}
	
	public double getUser_x() {
		return user_x;
	}

	public void setUser_x(double user_x) {
		this.user_x = user_x;
	}

	public double getUser_y() {
		return user_y;
	}

	public void setUser_y(double user_y) {
		this.user_y = user_y;
	}

	public String getPlace() {
		return place;
	}

	public void setPlace(String place) {
		this.place = place;
	}
	
	public void incUseCount(){
		int usecount = status.getUsecount();
		status.setUsecount(usecount+1);
	}
	public void desUseCount(){
		int count = status.getUsecount();
		status.setUsecount(count-1);
	}
	public void incPlusCount(){
		int count = status.getPluscount();
		status.setPluscount(count+1);
	}
	public void incLikeCount(){
		int count = status.getLikecount();
		status.setLikecount(count+1);
	}
	
	public String getJid() {
		return jid;
	}

	public void setJid(String jid) {
		this.jid = jid;
	}
}
